//
//  Monster.m
//  Cocos2DProject
//
//  Created by Sei Hyung Lee on 10. 4. 23..
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "Monster.h"


@implementation Monster

+(void) Spawn:(HelloWorld*)layer tileMapLayer:(CCTMXLayer*)tileMapLayer
{
	//CGRect spriteRect = (CGRect){CGPointZero, CGSizeMake(32, 32)};
	//sprite = [CCSprite spriteWithFile: @"CuteChicken.png" rect: spriteRect];
	sprite = [CCSprite spriteWithFile: @"CuteChicken.png"];
	
	position = [tileMapLayer positionAt:ccp(1, 1)];
	//spritePos.x += sprite.contentSize.width / 2;
	//spritePos.y += sprite.contentSize.height / 2;
	[sprite setScale: 0.4f];
	[sprite setPosition:position];
	[sprite setAnchorPoint:ccp(0.f, 0.f)];
	[layer addChild:sprite];
	
	NSLog(@"anchor point: %f, %f", sprite.anchorPoint.x, sprite.anchorPoint.y); 
	
	NSLog(@"pos %f, %f, rect pos %f, %f, rect size %f, %f", position.x, position.y,
		  sprite.textureRect.origin.x, sprite.textureRect.origin.y, 
		  sprite.textureRect.size.width, sprite.textureRect.size.height);
	
	CGPoint nextSpritePos = [tileMapLayer positionAt:ccp(1, 8)];
	CCAction *spriteMoveToAction = [CCMoveTo actionWithDuration: 3.f position: nextSpritePos];
	[sprite runAction:spriteMoveToAction];
	
	//nextSpritePos = [tileMapLayer positionAt:ccp(3, 8)];
	//spriteMoveToAction = [CCMoveTo actionWithDuration: 1.f position: nextSpritePos];
	//[sprite runAction:spriteMoveToAction];	
}

-(CGPoint) FindNextPosition
{
}

@end
